Skip to content

chore: implement audit maintainability recommendations#1188

Closed
BigSimmo wants to merge 3 commits into
mainfrom
execute-audit-remediation-plan
Closed

chore: implement audit maintainability recommendations#1188
BigSimmo wants to merge 3 commits into
mainfrom
execute-audit-remediation-plan

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

This PR safely implements the actionable decomposition and refactoring recommendations from the recent system audit.

Changes Included

  • ClinicalDashboard: Decomposed monolith by moving system and degraded notices to dashboard-notices.tsx to fit within the 4140 line budget limit.
  • Dynamic Imports: Lazy-loaded administration tools (SetupChecklist, UploadPanel, IndexingMonitor, IngestionQualityConsole) in ClinicalDashboard.tsx.
  • Edge Functions: Extracted string and labeling utilities from indexing-v3-agent/index.ts to utils.ts to respect the strict 2191 line limit.
  • Scripts: Removed redundant duplicated function in check-github-action-pins.mjs.
  • Configuration: Updated package.json and knip.json configuration where stale.

Excluded Changes

  • RAG Refactoring: rag.ts was excluded from decomposition since it is well within its maintainability budget (4919/5030 lines) and is protected by strict RAG ranking governance. Any change to rag.ts would require a live eval-canary before/after pair (doc/content recall pinned 1.0, zero per-case rr regressions).

RAG impact: no retrieval behaviour change — refactor only.

BigSimmo added 3 commits July 24, 2026 15:30
- Decompose ClinicalDashboard.tsx by extracting notices
- Lazy-load admin tools and UploadPanel via next/dynamic
- Extract indexing-v3-agent string tools to utils.ts to meet 2191 line budget
- Fix check-github-action-pins.mjs syntax duplication
@supabase

supabase Bot commented Jul 25, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy due to reaching the limit of concurrent preview branches.
Go to Project Integrations Settings ↗︎ if you wish to update this limit.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 109 files, which is 9 over the limit of 100.

To get a review, narrow the scope:
• coderabbit review --committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f8bc402-fd78-4daf-996b-ee9f8bab3f51

📥 Commits

Reviewing files that changed from the base of the PR and between fc9d162 and 8b86391.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (109)
  • .agents/skills/catalog.json
  • .agents/skills/prompt-perfector/SKILL.md
  • .gitattributes
  • .github/workflows/ci.yml
  • .github/workflows/pr-policy.yml
  • .npmrc
  • AGENTS.md
  • data/forms-catalog.json
  • docs/audit-handover-2026-07-14.md
  • docs/audit/repo-audit-2026-07-01.md
  • docs/audit/repo-wide-review-remediation-plan-2026-07-23.md
  • docs/audit/repo-wide-review-sweep-2026-07-19.md
  • docs/branch-review-ledger.md
  • docs/clinical-governance.md
  • docs/codex-review-protocol.md
  • docs/database-drift-detection.md
  • docs/ingestion-concurrency-fix-workorder.md
  • docs/outstanding-issues.md
  • docs/process-hardening.md
  • docs/search-chrome-behaviour.md
  • package.json
  • playwright.config.ts
  • scripts/audit-formatting-fixtures.ts
  • scripts/check-branch-review-ledger.mjs
  • scripts/check-github-action-pins.mjs
  • scripts/decompose-indexing-v3.mjs
  • src/app/api/answer/route.ts
  • src/app/api/answer/stream/route.ts
  • src/app/api/documents/[id]/reindex/route.ts
  • src/app/api/documents/bulk/reindex/route.ts
  • src/app/api/documents/bulk/route.ts
  • src/app/api/search/route.ts
  • src/app/api/upload/route.ts
  • src/app/globals.css
  • src/app/layout.tsx
  • src/app/privacy/page.tsx
  • src/app/reference/colour-coding/page.tsx
  • src/components/ClinicalDashboard.tsx
  • src/components/DocumentViewer.tsx
  • src/components/calculator-mockups/calculator-fixtures.ts
  • src/components/calculator-mockups/calculator-ui.tsx
  • src/components/clinical-dashboard/ClinicalSidebar.tsx
  • src/components/clinical-dashboard/answer-status.tsx
  • src/components/clinical-dashboard/dashboard-notices.tsx
  • src/components/clinical-dashboard/document-admin.tsx
  • src/components/clinical-dashboard/evidence-panels.tsx
  • src/components/clinical-dashboard/favourites-hub.tsx
  • src/components/clinical-dashboard/global-search-shell.tsx
  • src/components/clinical-dashboard/mobile-composer-reserve.ts
  • src/components/clinical-dashboard/settings-dialog.tsx
  • src/components/clinical-dashboard/signed-image.tsx
  • src/components/differentials/differential-presentation-workflow-page.tsx
  • src/components/document-viewer/source-panels.tsx
  • src/components/document-viewer/types.ts
  • src/components/factsheets/factsheets-data.ts
  • src/components/factsheets/factsheets-icons.ts
  • src/components/forms/form-detail-page.tsx
  • src/components/master-document-flow-mockups.tsx
  • src/components/mode-home-template.tsx
  • src/components/navigation-back-button.tsx
  • src/components/patient-safety-plan.tsx
  • src/components/services/service-detail-page.tsx
  • src/components/services/services-home-page.tsx
  • src/components/services/services-navigator-page.tsx
  • src/components/ui-primitives.tsx
  • src/components/ui/sheet.tsx
  • src/lib/answer-render-policy.ts
  • src/lib/compact-best-use-title.ts
  • src/lib/document-detail-contract.ts
  • src/lib/document-detail.ts
  • src/lib/form-catalog.ts
  • src/lib/ingestion-mutation-safety.ts
  • src/lib/search-scope.ts
  • src/lib/service-catalog-mapper.ts
  • src/lib/source-authority-metadata.ts
  • src/lib/source-authority-registry.ts
  • src/lib/source-metadata.ts
  • src/lib/supabase/database.types.ts
  • src/lib/validation/answer-request.ts
  • supabase/drift-manifest.json
  • supabase/functions/indexing-v3-agent/index.ts
  • supabase/functions/indexing-v3-agent/utils.ts
  • supabase/migrations/20260724120000_create_uploaded_document_with_ingestion_job.sql
  • supabase/schema.sql
  • tests/accessible-table.dom.test.tsx
  • tests/answer-render-policy.test.ts
  • tests/audit-content-services-regressions.test.ts
  • tests/clinical-dashboard-merge-artifacts.test.ts
  • tests/document-detail-performance.test.ts
  • tests/favourites-auth-gate.test.ts
  • tests/favourites-hub-unavailable-controls.dom.test.tsx
  • tests/formatting-fixture-audit.test.ts
  • tests/forms-back-navigation.dom.test.tsx
  • tests/forms.test.ts
  • tests/ingestion-mutation-safety.test.ts
  • tests/mobile-composer-reserve.test.ts
  • tests/navigation-back-button.dom.test.tsx
  • tests/pdf-extraction-budget.test.ts
  • tests/private-access-routes.test.ts
  • tests/search-scope.test.ts
  • tests/services-catalog.test.ts
  • tests/signed-image.dom.test.tsx
  • tests/source-authority-tooling.test.ts
  • tests/ui-overlay-css-contract.test.ts
  • tests/ui-tools.spec.ts
  • tests/visual-evidence-tabs.dom.test.tsx
  • worker/main.ts
  • worker/python/extract_pdf_assets.py
  • worker/python/test_extract_pdf_assets_budget.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch execute-audit-remediation-plan

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b86391139

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread worker/main.ts
Comment on lines +1212 to 1213
if (data.searchable !== false || retainForDocumentView) {
insertedImages.push({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep display-only images out of the retrieval list

When a table/page region falls below the caption budget but is retained for document viewing, it is persisted with searchable: false and then added to insertedImages here. That collection is subsequently passed to buildChunks, buildVisualDocumentIndexUnitInputs, table-fact generation, and supplemental embeddings, while its length is also treated as the searchable imageCount; therefore placeholder captions can enter retrieval and a generation containing no chunks or searchable images can bypass the empty-index safeguard. Maintain a separate display-only collection, and prove with a below-budget page_region test that it creates neither retrieval units nor a nonzero searchable image count; this retrieval behavior change also requires the repository's canary procedure.

AGENTS.md reference: AGENTS.md:L256-L259

Useful? React with 👍 / 👎.

navigateToMode(searchMode, { focus: true });
}
}}
onMobileBack={() => router.back()}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Route information-page back actions to an in-app fallback

On a phone, directly opening an information page such as a form or service detail after visiting an external site makes this shared back action call router.back(), which exits the application; with no prior history it may do nothing. The removed implementation deliberately routed each information-page family to its in-app parent, so use those canonical fallbacks rather than browser history and cover a direct-entry click in the header test.

AGENTS.md reference: AGENTS.md:L192-L195

Useful? React with 👍 / 👎.

@cursor

cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded by #1213.

Final review of tip 8b863911 confirmed it is not mergeable: conflict markers from archive base faa50e6, orphaned ClinicalDashboard import / dangling renderSystemNotice, invalid async export function sha256Hex, and missing CLINICAL_PHRASE_PATTERN colocated with the extracted utils. The intentional maintainability remediation was rebuilt cleanly on current main in #1213.

@BigSimmo BigSimmo closed this Jul 25, 2026
@cursor

cursor Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Closed as superseded by #1213 — clean rebuild of the intentional maintainability remediation on current main. Tip 8b863911 was not mergeable (conflict markers, parse breakers, ~469 behind). No content from this tip should be landed as-is.

BigSimmo added a commit that referenced this pull request Jul 25, 2026
BigSimmo added a commit that referenced this pull request Jul 25, 2026
Supersedes #1188. Extracts dashboard notices, lazy-loads admin tools, extracts indexing-v3 utils, and hardens Sheet autofocus for late-mounted Find fields.
BigSimmo added a commit that referenced this pull request Jul 25, 2026
Append-only ledger row for the #1213 land / #1188 supersede.
@BigSimmo
BigSimmo deleted the execute-audit-remediation-plan branch July 25, 2026 20:01
BigSimmo added a commit that referenced this pull request Jul 25, 2026
…#1240)

Branch-cleanup ledger row after deleting the rejected #1188 tip remote.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant